GtkEntry: get font description from GtkStyleContext
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 4 Jan 2011 01:28:19 +0000 (02:28 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 4 Jan 2011 02:06:20 +0000 (03:06 +0100)
gtk/gtkentry.c

index 69af6639ae9c88b9199a491cbaf2de51cb6d0dfb..7bcb8050828fba6475326935ca413783d880f2b0 100644 (file)
@@ -6169,6 +6169,8 @@ gtk_entry_move_adjustments (GtkEntry *entry)
   GtkAdjustment *adjustment;
   PangoContext *context;
   PangoFontMetrics *metrics;
+  GtkStyleContext *style_context;
+  GtkStateFlags state;
   gint x, layout_x, border_x, border_y;
   gint char_width;
 
@@ -6186,8 +6188,11 @@ gtk_entry_move_adjustments (GtkEntry *entry)
 
   /* Approximate width of a char, so user can see what is ahead/behind */
   context = gtk_widget_get_pango_context (widget);
-  metrics = pango_context_get_metrics (context, 
-                                       gtk_widget_get_style (widget)->font_desc,
+  style_context = gtk_widget_get_style_context (widget);
+  state = gtk_widget_get_state_flags (widget);
+
+  metrics = pango_context_get_metrics (context,
+                                       gtk_style_context_get_font (style_context, state),
                                       pango_context_get_language (context));
   char_width = pango_font_metrics_get_approximate_char_width (metrics) / PANGO_SCALE;